<?php


   class UserAction extends CommonAction{
   
     public function index(){
	 
	   
	   
	   $down1=M('dailiuser')->where('upid="%s"',session('did'))->select();
	   
	   if($_GET['j']==1){
	   
	   
	     $w1['upid']=array('eq',session('did'));
	   
	     $re=$this->page('dailiuser','10','id desc',$w1);
	   
	   
	     $num=M('dailiuser')->where($w1)->count();
	   
	   }
	 
	   if($_GET['j']==2){
	   
	   
	     $d2=array();
		 
	     foreach($down1 as $v){
		 
		    $d2[]=$v['id'];
		 
		 }
	   
	     $w2['upid']=array('IN',$d2);
	   
	   
	      $re=$this->page('dailiuser','10','id desc',$w2);
	   
	      $num=M('dailiuser')->where($w2)->count();
		  
		  if($num==""){
		  
		    $num=0;
		    
		  
		  }
		  
	   
	   }
	 
	 
	   if($_GET['j']==3){
	   
	       $d2=array();
		 
	     foreach($down1 as $v){
		 
		    $d2[]=$v['id'];
		 
		 }
	   
	   //  dump($d2);
	   
	     $w2['upid']=array('IN',$d2);
	   
	     $down2=M('dailiuser')->where($w2)->select();
		 
		// dump(M('dailiuser')->getlastsql());
		// dump($down2);
		 
		 $d3=array();
		 
		 
		 foreach($down2 as $v){
		 
		 $d3[]=$v['id'];
		 
		 }
		 
		 //  dump($d3);
		 
		 $w3['upid']=array('IN',$d3);
		 
		  $re=$this->page('dailiuser','10','id desc',$w3);
	   
	      $num=M('dailiuser')->where($w3)->count();
		  
		  if($num==""){
		  
		    $num=0;
		  
		  }
		  
		  
	   
	   }
	 
	  $this->num=$num;
	 
	  $this->re=$re;
	 
	 
	  $this->did=session('did');
	 
	   $this->sys=M('system')->where('id=1')->find();
	 
	 
	  $this->j=$_GET['j'];
	 
	   $this->display();
	 
	 }
   
   
   }